
//
// 120311 - AH - (Fantoft) Created.
// 120313 - AH - Made Serializable.
//

package org.soekrat.server.serialization;

import java.io.Serializable;

import org.soekrat.engine.SoekratName;

/**
 * <p>
 *   Describes retrieved data returned to client.
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC)
 */
public final class SoekratObjectSerializable implements Serializable
{
  private static final long serialVersionUID=7384833201447691894L;

  private final String name;
  
  private String content=null;
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param name Name of entry.
   */
  public SoekratObjectSerializable(SoekratName name)
  {
    if (name==null)
    {
      throw new NullPointerException("name");
    }
      
    this.name=name.getPure();
  }
    
  /**
   * <p>
   *   Gets name.
   * </p>
   * @return Name.
   */
  public String getName(){ return name; }
    
  /**
   * <p>
   *   Sets content.
   * </p>
   * @param c {@link String} that defines content.
   * @return {@code this}.
   */
  public SoekratObjectSerializable setContent(String c)
  {
    if (c==null)
    {
      throw new NullPointerException("c");
    }
    
    content=c;
    
    return this;
  }
  
  /**
   * <p>
   *   Gets content.
   * </p>
   * @return Content or {@code null} if does not have.
   */
  public String getContent(){ return content; }
  
}
